# base
snippet base "test" iw
	.PHONY: clean, mrproper
	CC = gcc
	CFLAGS = -g -Wall

	all: $1

	%.o: %.c
		$(CC) $(CFLAGS) -c -o $@ $<
	
	${1:out}: $1.o
		$(CC) $(CFLAGS) -o $@ $+

	clean:
		rm -f *.o core.*

	mrproper: clean
		rm -f $1
endsnippet
###########################################################verilator makefile 模板
snippet verilator_mk "verilator makefile 模板" iw
# -sv 等于 --language 1800-2005
all:
	verilator --cc --autoflush --trace  ../${1}.v --exe testbench.cpp 

comp:
	make -C obj_dir -j -f V$1.mk V$1

run:
	./obj_dir/V$1 
clean:
	rm -rf obj_dir
endsnippet

